package com.pan.admin.module.visualizer.service.impl;

import com.pan.admin.module.visualizer.dao.ApiDataStatisticsDao;
import com.pan.admin.module.visualizer.entity.po.ApiDataStatisticsPO;
import com.pan.admin.module.visualizer.entity.po.ApiLogVisualizerPO;
import com.pan.admin.module.visualizer.entity.qo.ApiLogVisualizerQO;
import com.pan.admin.module.visualizer.entity.qo.ApiVisualizerQO;
import com.pan.admin.module.visualizer.service.ApiDataStatisticsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class ApiDataStatisticsServiceImpl implements ApiDataStatisticsService {

    @Autowired
    private ApiDataStatisticsDao apiDataStatisticsDao;

    @Override
    public void batchInsert(List<ApiDataStatisticsPO> listApiDataStatisticsPO) {
        apiDataStatisticsDao.batchInsert(listApiDataStatisticsPO);
    }

    @Override
    public int update(ApiDataStatisticsPO apiDataStatisticsPO) {
        return 0;
    }

    @Override
    @Transactional(readOnly = true)
    public List<ApiDataStatisticsPO> listNotExistApiClient() {
        return apiDataStatisticsDao.listNotExistApiClient();
    }

    @Override
    @Transactional(readOnly = true)
    public List<ApiDataStatisticsPO> listApiDataStatistics() {
        return apiDataStatisticsDao.listApiDataStatistics();
    }

    @Override
    @Transactional(readOnly = true)
    public List<ApiDataStatisticsPO> listFlow(ApiVisualizerQO apiVisualizerQO) {
        return apiDataStatisticsDao.listFlow(apiVisualizerQO);
    }

    @Override
    @Transactional(readOnly = true)
    public List<ApiDataStatisticsPO> listBill(ApiVisualizerQO apiVisualizerQO) {
        return apiDataStatisticsDao.listBill(apiVisualizerQO);
    }

    @Override
    @Transactional(readOnly = true)
    public List<ApiLogVisualizerPO> listApiLogCountByApiClientId(ApiLogVisualizerQO apiLogVisualizerQO) {
        return apiDataStatisticsDao.listApiLogCountByApiClientId(apiLogVisualizerQO);
    }
}
